package edu.zut.software.identity.Repository;

import edu.zut.software.identity.domain.StuInfo;
import edu.zut.software.identity.domain.TeaCollege;
import edu.zut.software.identity.domain.TeacherInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author Weining
 */
@Repository
public interface TeaInfoRepository extends JpaRepository<TeacherInfo,Object>, JpaSpecificationExecutor<TeacherInfo> {
    @Query(value = "select *\n" +
            "    from teacher_info t\n" +
            "    where  t.college_name=?1",
            nativeQuery = true)
    List<TeacherInfo> getTeacherInfoByCollege(@Param("name") String name);
    @Query(value = "select *\n" +
            "    from teacher_info t\n" +
            "    where  t.major_name=?1",
            nativeQuery = true)
    List<TeacherInfo> getTeacherInfoByMajor(@Param("name") String name);
}

